﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Numerics;

namespace WaveSim.Core.Equations.Galerkin
{
    public class Wave
    {
        /// <summary>
        /// Speed of light in meters per second
        /// </summary>
        public const double SpeedOfLight = 299792458;

        /// <summary>
        /// The generator frequency in Hz
        /// </summary>
        public double F0 { get; set; }

        /// <summary>
        /// The wave number
        /// </summary>
        /// <param name="wg">waveguide</param>
        /// <param name="m">number of x-mods</param>
        /// <param name="n">number of y-mods</param>
        /// <returns>the wave number</returns>
        public Complex K(WaveGuide wg, int m, int n)
        {
            // the generator wave length
            //double wl0 = SpeedOfLight / this.F0;

            // wlc2 - critical wave length
            //double wl2 = (m * Math.PI / wg.A) * (m * Math.PI / wg.A) + (n * Math.PI / wg.B) * (n * Math.PI / wg.B);
            //double wlc2 = 4 * Math.PI * Math.PI / wl2;
            //double ration = wl0 * wl0 / wlc2;

            return 2 * Math.PI * this.F0 / SpeedOfLight;
            //return 2 * Math.PI * this.F0 / SpeedOfLight * Complex.Sqrt(1 - ration);
        }

        public Complex K(WaveGuide wg, int m)
        {
            return K(wg, m, 0);
        }
    }
}
